package com.yanqu.road.server.cmd.minewar;

import com.yanqu.road.pb.minewar.MineWarProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.MineWarModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.server.command.Cmd;

@Cmd(code= Protocol.S_MINE_WAR_REFUGE_RECALL, desc = "矿场避难所召回")
public class MineRefugeRecallCmd extends AbstractCommand {

    int mineType;

    int pitId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MineWarProto.MineRefugeRecallReqMsg reqMsg = MineWarProto.MineRefugeRecallReqMsg.parseFrom(packet.getBytes());
        mineType = reqMsg.getMineType();
        pitId = reqMsg.getPitId();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        player.sendPacket(Protocol.U_MINE_WAR_REFUGE_RECALL, player.getModule(MineWarModule.class).refugeRecall(mineType, pitId));
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
